// 熵计算模块

function calculateEntropy(probabilities) {
  let entropy = 0;
  for (let p of probabilities) {
      if (p > 0) {  // 确保 p 是正数
          entropy -= p * Math.log2(p);
      }
  }
  return entropy;
}


module.exports = { calculateEntropy };


